package com.pignest.hotel.beans.report;

import com.pignest.framework.util.Utils;
import com.pignest.hotel.beans.TbCloseAccounts;
import com.pignest.hotel.servlet.report.BaseReport;
import com.pignest.hotel.util.DateUtil;

public class CheckoutDetail {

	private String orderNumber;
	private String time;
	private String roomName;
	private String customer;
	private String price;
	private String amount;
	private String livingTime;
	private String leaveTime;
	private String operator;
	
	
	public String getOrderNumber() {
		return orderNumber;
	}
	public void setOrderNumber(String orderNumber) {
		this.orderNumber = orderNumber;
	}
	public String getTime() {
		return time;
	}
	public void setTime(String time) {
		this.time = time;
	}
	public String getRoomName() {
		return roomName;
	}
	public void setRoomName(String roomName) {
		this.roomName = roomName;
	}
	public String getCustomer() {
		return customer;
	}
	public void setCustomer(String customer) {
		this.customer = customer;
	}
	public String getPrice() {
		return price;
	}
	public void setPrice(String price) {
		this.price = price;
	}
	public String getAmount() {
		return amount;
	}
	public void setAmount(String amount) {
		this.amount = amount;
	}
	public String getLivingTime() {
		return livingTime;
	}
	public void setLivingTime(String livingTime) {
		this.livingTime = livingTime;
	}
	public String getLeaveTime() {
		return leaveTime;
	}
	public void setLeaveTime(String leaveTime) {
		this.leaveTime = leaveTime;
	}
	public String getOperator() {
		return operator;
	}
	public void setOperator(String operator) {
		this.operator = operator;
	}
	
	public static CheckoutDetail fromCloseAccount(TbCloseAccounts account) {
		CheckoutDetail d = new CheckoutDetail();
		d.setOrderNumber(account.getOrderNo());
		d.setTime(DateUtil.toString(account.getTime(), BaseReport.TIME_FORMAT));
		d.setAmount(Utils.toPrice(account.getAccounts()));
		d.setCustomer(account.getLiving().getCustormName());
		d.setLivingTime(DateUtil.toString(account.getLiving().getLiveTime(), BaseReport.TIME_FORMAT));
		d.setLeaveTime(DateUtil.toString(account.getLiving().getLeaveDate(), BaseReport.TIME_FORMAT));
		d.setOperator(account.getUsername());
		d.setPrice(Utils.toPrice(account.getLiving().getAdjustPrice()));
		d.setRoomName(account.getLiving().getRoom().getName());
		return d;
	}
}
